package com.eureka.server;

import com.netflix.appinfo.ApplicationInfoManager;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.appinfo.MyDataCenterInstanceConfig;
import com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider;
import com.netflix.discovery.DefaultEurekaClientConfig;
import com.netflix.discovery.DiscoveryClient;
import com.netflix.discovery.EurekaClient;
import org.springframework.stereotype.Service;

@Service
public class DemoServerImpl implements DemoServer {


    public String sayHello(String str) {
// 创建ApplicationInfoManager对象（用来注册、注销当前实例）
//        ApplicationInfoManager applicationInfoManager = new ApplicationInfoManager(
//                new MyDataCenterInstanceConfig(), new EurekaConfigBasedInstanceInfoProvider(instanceConfig).get());
//// 创建EurekaClient对象（用来获取其他服务以及提供内部入口用来注册、续约、和注销当前实例）
//        EurekaClient eurekaClient = new DiscoveryClient(applicationInfoManager, new DefaultEurekaClientConfig());
//// 设置当前实例状态为STARTING
//        applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.STARTING);
//// 设置当前实例状态为UP
//        applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.UP);

        return "hello" + str;
    }
}
